package Model;
// Generated Dec 2, 2012 9:07:08 PM by Hibernate Tools 3.2.1.GA


import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * CrumbsRequest generated by hbm2java
 */
@Entity
@Table(name="CRUMBS_REQUEST"
    ,schema="NETCRACKER"
)
public class CrumbsRequest  implements java.io.Serializable {


     private int id;
     private CrumbsClient crumbsClient;
     private CrumbsRequestsState crumbsRequestsState;
     private Date dateOfCreation;
     private String requestInfo;
     private Integer actualTimeOfWork;
     private Set<CrumbsUser> crumbsUsers = new HashSet<CrumbsUser>(0);
     private Set<CrumbsProcessHistory> crumbsProcessHistories = new HashSet(0);

    public CrumbsRequest() {
    }

	
    public CrumbsRequest(int id, CrumbsClient crumbsClient, CrumbsRequestsState crumbsRequestsState, Date dateOfCreation) {
        this.id = id;
        this.crumbsClient = crumbsClient;
        this.crumbsRequestsState = crumbsRequestsState;
        this.dateOfCreation = dateOfCreation;
    }
    public CrumbsRequest(int id, CrumbsClient crumbsClient, CrumbsRequestsState crumbsRequestsState, Date dateOfCreation, String requestInfo, Integer actualTimeOfWork, Set<CrumbsUser> crumbsUsers, Set<CrumbsProcessHistory> crumbsProcessHistories) {
       this.id = id;
       this.crumbsClient = crumbsClient;
       this.crumbsRequestsState = crumbsRequestsState;
       this.dateOfCreation = dateOfCreation;
       this.requestInfo = requestInfo;
       this.actualTimeOfWork = actualTimeOfWork;
       this.crumbsUsers = crumbsUsers;
       this.crumbsProcessHistories = crumbsProcessHistories;
    }
   
     @Id 
    
    @Column(name="ID", unique=true, nullable=false, precision=9, scale=0)
    public int getId() {
        return this.id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="CLIENT_ID", nullable=false)
    public CrumbsClient getCrumbsClient() {
        return this.crumbsClient;
    }
    
    public void setCrumbsClient(CrumbsClient crumbsClient) {
        this.crumbsClient = crumbsClient;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="STATE_ID", nullable=false)
    public CrumbsRequestsState getCrumbsRequestsState() {
        return this.crumbsRequestsState;
    }
    
    public void setCrumbsRequestsState(CrumbsRequestsState crumbsRequestsState) {
        this.crumbsRequestsState = crumbsRequestsState;
    }
    @Temporal(TemporalType.DATE)
    @Column(name="DATE_OF_CREATION", nullable=false, length=7)
    public Date getDateOfCreation() {
        return this.dateOfCreation;
    }
    
    public void setDateOfCreation(Date dateOfCreation) {
        this.dateOfCreation = dateOfCreation;
    }
    
    @Column(name="REQUEST_INFO", length=500)
    public String getRequestInfo() {
        return this.requestInfo;
    }
    
    public void setRequestInfo(String requestInfo) {
        this.requestInfo = requestInfo;
    }
    
    @Column(name="ACTUAL_TIME_OF_WORK", precision=9, scale=0)
    public Integer getActualTimeOfWork() {
        return this.actualTimeOfWork;
    }
    
    public void setActualTimeOfWork(Integer actualTimeOfWork) {
        this.actualTimeOfWork = actualTimeOfWork;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinTable(name="CRUMBS_REQUEST_ASSIGN", schema="NETCRACKER", joinColumns = { 
        @JoinColumn(name="REQUEST_ID", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="USER_ID", nullable=false, updatable=false) })
    public Set<CrumbsUser> getCrumbsUsers() {
        return this.crumbsUsers;
    }
    
    public void setCrumbsUsers(Set<CrumbsUser> crumbsUsers) {
        this.crumbsUsers = crumbsUsers;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="crumbsRequest")
    public Set<CrumbsProcessHistory> getCrumbsProcessHistories() {
        return this.crumbsProcessHistories;
    }
    
    public void setCrumbsProcessHistories(Set<CrumbsProcessHistory> crumbsProcessHistories) {
        this.crumbsProcessHistories = crumbsProcessHistories;
    }




}


